package com.giacom.docx4j.plugin.impl;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

/**
 * Classe utilitaria para compilação
 * @author Sandro
 *
 */
public class ClassCompiler {

	
	public void compileClass(String file) throws Exception{
		
		JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
		int result = compiler.run( System.in, System.out, System.err, file );
		if ( 0 == result ) {
			System.out.println( "Compilado!" );
		}
		
	}
	
	public static void main(String[] args) {
		ClassCompiler c = new ClassCompiler();
		
		try {
			c.compileClass("./gen/Pessoa.java");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
}
